﻿<!DOCTYPE html>
<html xmlns:ss="http://sweetsurvey.com">
<head>
    <title>@ViewBag.Title</title>
    <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/themes/Smoothness/jquery-ui.custom.css")" rel="stylesheet" type="text/css" id="theme" />
    <script src="@Url.Content("~/Scripts/jquery-1.5.2.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery-ui.custom.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.tmpl.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/json2.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/CustomScripts/Utilities.js")" type="text/javascript"></script>
    <style type="text/css">
        .text-align-left { text-align:left }
        .full-width { width:100% }
        .gray-background { background-color:Silver }
        #tabs div { min-height:500px; }
    </style>
</head>
<body>
    <div id="tabs">
        <ul>
            <li><a href="#welcome">Welcome</a></li>
            <li><a href="#allSurveys">All Surveys</a></li>
            <li><a href="#allUsers">All Participators</a></li>
        </ul>
        <div id="welcome">Loading...</div>
        <div id="allSurveys">Loading...</div>
        <div id="allUsers">Loading...</div>
    </div>
    <div id="content">@RenderBody()</div>
    <script type="text/javascript">
        $(function () {
            // detect current tab
            var action = '@this.ViewContext.RouteData.Values["Action"]';
            var index;
            if (action == 'Index') { index = 0; }
            else if (action == 'Surveys') { index = 1; }
            else if (action == 'Participators') { index = 2; }
            // select current tab
            var tabs = $('#tabs');
            tabs.tabs();
            tabs.tabs('select', index);
            // fill content
            var target = $('#tabs > div:eq(' + index + ')').empty();
            $('#content').appendTo(target).show();
            // bind events
            tabs.on('tabsselect', function (event, ui) {
                if (ui.index == 0) { window.location = '@Url.Action("Index", "Administrator")'; }
                else if (ui.index == 1) { window.location = '@Url.Action("Surveys", "Administrator")'; }
                else if (ui.index == 2) { window.location = '@Url.Action("Participators", "Administrator")'; }
            });
        });
    </script>
</body>
</html>